<?php 
      $check1 = "";
      $check2 = "";
      if($this->page_content->visible == "1"){ 
            $check1 = "checked";
      }else{
            $check2 = "checked";
      }
?>
<section id="main" class="column"  style="width:100%;">
      <?php
            if($this->result == true){
                  print "<h4 class='alert_success'>De pagina is succesvol bewerkt</h4>";
            }
            print $this->message;
            ?>
            <article class="module width_full" style="width:100%; float:left; ">
					<script language="JavaScript">
						var text;
						var wind1;
                    function edit() {
						var edit={}
						text = data.content.innerHTML;
						edit.src = data.innerHTML;
						wind1 = window.open("<?=$this->baseUrl()?>/template/preview.php", "popup");
						wind1.document.getElementById('content').innerHTML(data.content.innerHtml);
						
						var content = popup.document.getElementById('content');
						content.innerHTML = data.content.innerHTML;
						
						//window.showModalDialog("<?=$this->baseUrl()?>/template/preview.php?value="+data.content.innerHTML, edit,"dialogWidth:1000px;dialogHeight:800px;help:no;status:no;scroll:yes;resizable:yes;")
						}
                    </script>
			
                <form action="<?=$this->baseUrl();?>/administrator/editpage?id=<?=$_GET['id']?>" method="POST" id="data">
                  <header><h3>Pagina bewerken</h3>
                           <p><a href="./editpage?remove=<?=$this->page_content->id?>">Verwijderen</a>
                         &nbsp&nbsp&nbsp&nbsp&nbspZichbaar:      
                        <input type="radio" name="visible" value="1" <?=$check1?>  /> Ja
                        <input type="radio" name="visible" value="0" <?=$check2?> /> Nee
                        </p>
                  </header>
                <div class="module_content">
						<textarea id="content" name="content" cols="90" rows="30">
							<?php
								if( !$this->page_content == NULL ){
									echo $this->page_content->content;
								} else {
									echo "LET OP: Deze pagina heeft nog geen inhoud";
								}
							?>
						</textarea>
						<script type="text/javascript">
							CKEDITOR.replace( 'content' );
						</script>
						<!-- Get the page name thats edit -->
						<input type="hidden" name="page_name" value="<?=$this->page_content->name?>" />
						<input style="margin:5px;" type="submit" value="Opslaan" />
                                    <div style="float:right;">
                       
                        </div>
                        <a href="#" style="float:right; margin-right:20px; margin-top:13px;" onclick="edit()">Voorbeeld</a>
					</form>
                </div>
            </article>
			<article class="module width_quarter" style="float:left;">
            	<header><h3>Pagina's</h3></header>
            	<div class="module_content">
            		<ul>
            		<?php 
            			

                                    foreach ($this->menu as $value) {
                                          print "<a href='" . $this->baseUrl() ."/administrator/editpage?id=". $value->id . "' />". $value->name ."</a><br/>";
                                    }

            		?>
            		</ul>
            	</div>
            </article>
</section>